/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __MOKOKO_MEDIA_H__
#define __MOKOKO_MEDIA_H__
#include "list.h"
#include "song.h"
#include "collections.h"
#include <gst/gst.h>

typedef enum {
        MOKOKO_STATE_VOID_PENDING        = (int)GST_STATE_VOID_PENDING,
        MOKOKO_STATE_NULL                = (int)GST_STATE_NULL,
        MOKOKO_STATE_READY               = (int)GST_STATE_READY,
        MOKOKO_STATE_PAUSED              = (int)GST_STATE_PAUSED,
        MOKOKO_STATE_PLAYING             = (int)GST_STATE_PLAYING,
        MOKOKO_STATE_PIPELINE_NULL
} MokokoState;

typedef struct _MKK_Event MKK_Event;
struct _MKK_Event
{
   int type;
   unsigned long value;
   char *message;
};

typedef enum {
   MKK_EVENT_TYPE_STATUS,
   MKK_EVENT_TYPE_POSITION,
   MKK_EVENT_TYPE_VOLUME,
   MKK_EVENT_TYPE_ERROR
} MKK_Event_Type;

int MKK_PLAYBACK_EVENT;


int                mokoko_media_init(int args, char ** argv);
void               mokoko_media_deinit();

int                mokoko_media_play(const char *file);
void               mokoko_media_pause();
void               mokoko_media_resume();
void               mokoko_media_stop();
void               mokoko_media_play_next();
void               mokoko_media_play_prev();

Song              *mokoko_media_playing_song_get();

unsigned long      mokoko_media_track_length_get();
unsigned long      mokoko_media_track_position_get();
void               mokoko_media_track_position_set(unsigned long position);

MokokoState        mokoko_media_state_get();

void               mokoko_media_volume_up();
void               mokoko_media_volume_down();
void               mokoko_media_volume_set(guint vol);
int                mokoko_media_volume_get();
void               mokoko_media_setMuted(int muted);
int                mokoko_media_isMuted();

void               mokoko_media_playlist_play(int repeat, int shuffle, int index);
int                mokoko_media_collections_set(Collections *c);
void               mokoko_media_playlist_shuffle_set(int onoff);
int                mokoko_media_playlist_shuffle_get();
void               mokoko_media_playlist_repeat_set(int onoff);
int                mokoko_media_playlist_repeat_get();

#endif
